package cn.lzy.demo.okhttp;

import okhttp3.OkHttpClient;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @Description
 * @Author lzy
 * @Date 2023/12/5 19:46
 * @Version
 **/
public class TestDemoFactoryBean {
    public static void main(String[] args) {
        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml");
        // 获取 okHttpClientFactoryBean 所对应的工厂类（在 id 前面添加一个 & 符号，就可以获取到 FactoryBean。）
        Object bean = ctx.getBean("&okHttpClientFactoryBean");
        Object bean2 = ctx.getBean("okHttpClientFactoryBean");
        System.out.println("bean.getClass() = " + bean.getClass());
        System.out.println("bean2.getClass() = " + bean2.getClass());
    }
}
